package database;

import model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

/**
 * User: JAAN
 * Date: 9.05.12
 */
@Component
public class UserService {
  @Autowired
  private JdbcTemplate jdbcTemplate;

  public User getUser(String username) {
    return null;
  }

  public void saveUser(User user) {
      String sql = "INSERT INTO USERS (firstname, lastname, username, email, password) VALUES " +
        "('" + user.getFirstname() + "'," +
        "'" + user.getLastname() + "'," +
        "'" + user.getUsername() + "'," +
        "'" + user.getEmail() + "'," +
        "'" + user.getPassword() + "');";
      jdbcTemplate.execute(sql);
  }
}
